<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn" href="{:U('add')}">新 增</a>
        </div>

        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
                <!--                <input type="text" name="nickname" class="search-input" value="{:I('nickname')}" placeholder="请输入用户昵称或者ID">
                                <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>-->
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">

        <ul>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <li style="border: 1px solid #CCC; padding: 10px 50px 10px 10px; margin-bottom: 20px;overflow: hidden;">
                        <div style="float:left;width: 60%;">
                            <h2 style="font-size: 18px;color: #000;">{$vo.topic_name}</h2>
                            <p style="font-size: 12px;">{$vo.topic_content}</p>
                            <div style="margin-top:10px;">
                                <span style="margin-right: 10px;">喜欢:<i style="color:red;margin-right: 5px;">{$vo.follow_num}</i>人</span>
                                <span style="margin-right: 10px;">帖子数:<i style="color:red;margin-right: 5px;">{$vo.post_num}</i>条</span>
                                <span> <a href="{:U('info',array('id'=>$vo['topic_id']))}" class="">查看</a></span>
                                <span> <a href="{:U('add',array('id'=>$vo['topic_id']))}" class="">编辑</a></span>
                                <span> <a href="{:U('del',array('id'=>$vo['topic_id']))}" class="ajax-get confirm">删除</a></span>
                            </div>

                        </div>
                        <div style="float:right;">
                            <img width="400px" height="100px" src="__ROOT__{$vo.topic_pic}">
                        </div>
                    <li>
                </volist>
                <else/>
                <li class="text-center"> aOh! 暂时还没有内容! </li>
            </notempty>
        </ul>

    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });

        //导航高亮
        highlight_subnav('{:U('Dog / index')}');
    </script>
</block>
